package com.dousb.cloudlibrary.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.dousb.cloudlibrary.model.dto.announcement.AnnouncementQueryRequest;
import com.dousb.cloudlibrary.model.entity.Announcement;
import com.dousb.cloudlibrary.model.vo.AnnouncementVO;

import javax.servlet.http.HttpServletRequest;

/**
 * 公告表服务
 */
public interface AnnouncementService extends IService<Announcement> {

    /**
     * 校验数据
     *
     * @param announcement
     * @param add          对创建的数据进行校验
     */
    void validAnnouncement(Announcement announcement, boolean add);

    /**
     * 获取查询条件
     *
     * @param announcementQueryRequest
     * @return
     */
    QueryWrapper<Announcement> getQueryWrapper(AnnouncementQueryRequest announcementQueryRequest);

    /**
     * 获取公告表封装
     *
     * @param announcement
     * @param request
     * @return
     */
    AnnouncementVO getAnnouncementVO(Announcement announcement, HttpServletRequest request);

    /**
     * 分页获取公告表封装
     *
     * @param announcementPage
     * @param request
     * @return
     */
    Page<AnnouncementVO> getAnnouncementVOPage(Page<Announcement> announcementPage, HttpServletRequest request);

    /**
     * 是否发布公告
     *
     * @param announcement
     * @return boolean
     * @author 豆沙包
     * @date 2025/10/10 21:17
     */

    boolean publishAnnouncement(Announcement announcement);
}
